const directived = {
  install (Vue) {
    Vue.directive('focus', {
      inserted (el) {
        if (el.nodeName === 'TEXTAREA' || el.nodeName === 'INPUT') {
          el.focus()
        } else {
          const txt = el.querySelector('textarea')
          const inp = el.querySelector('input')
          if (txt) {
            txt.focus()
          }
          if (inp) {
            inp.focus()
          }
        }
      },
      update (el) {
        if (el.nodeName === 'TEXTAREA' || el.nodeName === 'INPUT') {
          el.focus()
        } else {
          const txt = el.querySelector('textarea')
          const inp = el.querySelector('input')
          if (txt) {
            txt.focus()
          }
          if (inp) {
            inp.focus()
          }
        }
      }
    })
  }
}
export default directived
// export default function (Vue) {
//     Vue.directive('focus', {
//         inserted(el) {
//             el.querySelector('input').focus()
//         }
//     })
// }
